package com.ztgf.order.api.cms.pay;

import com.ztgf.common.constant.Result;
import com.ztgf.order.models.bo.pay.PayOrderSaveBO;
import com.ztgf.order.models.service.pay.IPayService;
import com.ztgf.order.models.vo.pay.PayOrderMoneyVO;
import com.ztgf.order.models.vo.pay.PayOrderVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 支付日志表控制器
 *
 * @author mxli
 * @Date 2021-06-03 16:12:28
 */

@RestController
@RequestMapping("/cms/payOrder")
@Slf4j
@Api(value = "PayOrderApiController",tags = "支付相关接口")
public class PayOrderController {

    @DubboReference
    private IPayService payService;

    @PostMapping("/getPayMoney")
    @ApiOperation(value = "获取支付金额",notes = "获取支付金额")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "ids",value = "ids,以逗号分隔",required = true,paramType = "query", dataType = "String"),
            @ApiImplicitParam(name = "type",value = "支付类型：0订单金额，1佣金、2店铺保证金、3年费、4采购申请平台砍价、5砍价手续费、15缴纳物流保证金、18支付物流账单",required = true,paramType = "query", dataType = "Integer")
    })
    public Result<PayOrderMoneyVO> getPayMoney(String ids, Integer type){
        return  payService.getPayMoney(ids, type, true);
    }


    @ApiOperation(value = "支付",notes = "支付")
    @PostMapping("/pay")
    public Result<PayOrderVO> pay(PayOrderSaveBO bo){
        return payService.savePay(bo, false);
    }
}